<template>
  <view class="container">
    <!-- 主内容区 -->
    <view class="main-content">
      <!-- 介绍部分 -->
      <view class="intro-section">
        <text class="intro-title">精选技术面试题</text>
        <text class="intro-desc">选择您感兴趣的技术领域，查看相关面试题和答案，助您面试成功</text>
      </view>

      <!-- 分类列表 -->
      <view class="categories">
        <!-- 前端面试题 -->
        <view 
          class="category-card" 
          @click="navigateToDetail(item)"
		  v-for="(item , index) in dataList" 
		  :key="index"
        >
          <view class="card-icon-container primary-bg">
            <i class="fa fa-code text-6xl primary-color"></i>
          </view>
          <view class="card-content">
            <text class="card-title">
              <i class="fa fa-html5 mr-2 orange-color"></i>{{item.name}}
            </text>
            <text class="card-desc">{{item.remark}}</text>
            <view class="card-footer">
              <text class="question-count primary-bg primary-color">
                <i class="fa fa-question-circle mr-1"></i>{{item.count}}+ 题目
              </text>
              <text class="view-detail primary-color">
                查看详情 <i class="fa fa-arrow-right ml-1"></i>
              </text>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
		dataList:[]
	};
  },
  onLoad() {
	  this.getInit()
  },
  methods: {
	async getInit(){
		let result = await this.$axios("overallSituation" , {databaseName:'interview' , state:'look'} , true)
		if(result.code == 200){
			this.dataList = result.data || []
		}
	},
	  
	  
    // 导航到详情页
    navigateToDetail(item) {
	  this.$router( `/subPackages2/pages/interview/detail?id=${item._id}`)	
    },
  }
};
</script>

<style scoped>
/* 全局样式 */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 导航栏样式 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transition: all 0.3s ease;
  padding: 16px;
}

.header-scrolled {
  padding: 8px 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.header-dark {
  background-color: #1e293b;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.header-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #3b82f6;
  display: flex;
  align-items: center;
}

.theme-toggle {
  padding: 8px;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: #f1f5f9;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  padding-top: 88px;
  padding-bottom: 64px;
  background-color: #f8fafc;
  transition: background-color 0.3s ease;
}

.dark-mode {
  background-color: #0f172a;
  color: #ffffff;
}

/* 介绍部分样式 */
.intro-section {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 32px;
  padding: 0 16px;
}

.intro-title {
  font-size: 1.75rem;
  font-weight: bold;
  display: block;
  margin-bottom: 16px;
}

.intro-desc {
  font-size: 1rem;
  color: #64748b;
  line-height: 1.5;
}

.dark-mode .intro-desc {
  color: #94a3b8;
}

/* 分类列表样式 */
.categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .categories {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-card {
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dark-mode .category-card {
  background-color: #1e293b;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-icon-container {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-content {
  padding: 20px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: bold;
  display: block;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.card-desc {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 16px;
  line-height: 1.5;
}

.dark-mode .card-desc {
  color: #94a3b8;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-count {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.view-detail {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

/* 页脚样式 */
.footer {
  background-color: #1e293b;
  color: #ffffff;
  padding: 24px 16px;
}

.footer-dark {
  background-color: #0f172a;
}

.copyright {
  color: #94a3b8;
  display: block;
  text-align: center;
  margin-bottom: 16px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.social-icon {
  color: #94a3b8;
  transition: color 0.2s ease;
}

.social-icon:hover {
  color: #ffffff;
}

/* 颜色定义 */
.primary-color {
  color: #3b82f6;
}

.secondary-color {
  color: #10b981;
}

.accent-color {
  color: #8b5cf6;
}

.orange-color {
  color: #f97316;
}

.blue-color {
  color: #0369a1;
}

.gray-color {
  color: #374151;
}

.primary-bg {
  background-color: rgba(59, 130, 246, 0.1);
}

.secondary-bg {
  background-color: rgba(16, 185, 129, 0.1);
}

.accent-bg {
  background-color: rgba(139, 92, 246, 0.1);
}
</style>
